<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>资源定位系统</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<style type="text/css">
body, html {
	width: 100%;
	height: 100%;
	margin: 0;
	font-family: "微软雅黑";
	font-size: 14px;
}

#l-map {
	width: 100%;
	height: 100%;
	overflow: hidden;
}
</style>
<script type="text/javascript"
	src="http://api.map.baidu.com/api?v=2.0&ak=Y6BOo5cdZLAIdE5uSBSl8o4fb7aiWE0Q"></script>
<!-- 加载百度地图样式信息窗口 -->
<script type="text/javascript"
	src="http://api.map.baidu.com/library/SearchInfoWindow/1.5/src/SearchInfoWindow_min.js"></script>
<link rel="stylesheet"
	href="http://api.map.baidu.com/library/SearchInfoWindow/1.5/src/SearchInfoWindow_min.css" />
</head>

<body>
	<div id="l-map"></div>
</body>
</html>
<script type="text/javascript">
	// 百度地图API功能
	var map = new BMap.Map("l-map"); // 创建地图实例
	//var point = new BMap.Point(126.6492,45.707329);  // 创建点坐标
	//map.centerAndZoom(point, 6);                 // 初始化地图，设置中心点坐标和地图级别
	map.centerAndZoom("黑龙江", 6);
	map.enableScrollWheelZoom();
	map.addControl(new BMap.NavigationControl()); //添加默认缩放平移控件
	var customLayer = new BMap.CustomLayer({
		geotableId : 162180,
		q : '', //检索关键字
		tags : '', //空格分隔的多字符串
		filter : '' //过滤条件,参考http://developer.baidu.com/map/lbs-geosearch.htm#.search.nearby
	});
	map.addTileLayer(customLayer);
	customLayer.addEventListener('onhotspotclick', callback);

	function callback(e) //单击热点图层
	{
		var customPoi = e.customPoi; //poi的默认字段
		var contentPoi = e.content; //poi的自定义字段
		var content = '<p style="width:280px;margin:0;line-height:20px;">仪器id：' + contentPoi.instrument_id + '<br/>仪器名称:' + contentPoi.instrument_name + '</p>';
		var searchInfoWindow = new BMapLib.SearchInfoWindow(map, content, {
			title : customPoi.title, //标题
			width : 290, //宽度
			height : 40, //高度
			panel : "panel", //检索结果面板
			enableAutoPan : true, //自动平移
			enableSendToPhone : true, //是否显示发送到手机按钮
			searchTypes : [
				BMAPLIB_TAB_SEARCH, //周边检索
				BMAPLIB_TAB_TO_HERE, //到这里去
				BMAPLIB_TAB_FROM_HERE //从这里出发
			]
		});
		var point = new BMap.Point(customPoi.point.lng, customPoi.point.lat);
		searchInfoWindow.open(point);
	}
</script>
